#ifndef OBJECT_H
#define OBJECT_H

#include "ObjectId.h"
#include "ObjectPath.h"

class QUINCE_CORE_EXPORT Object : public QObject
{
    Q_OBJECT
    Q_PROPERTY(ObjectId id READ id WRITE setId);

public:
    virtual ~Object();

    Object & operator = (const Object &other);

    ObjectId id() const { return m_id; }
    void setId(const ObjectId &value) { m_id = value; }
protected:
    Object();
    Object(const ObjectId &id);
    Object(const Object &other);

private:
    class ObjectGlobalId : public ObjectId
    {
    public:
        ObjectGlobalId();
        ObjectGlobalId(const ObjectGlobalId &);
    private:
        static unsigned int sNextGlobalValue;
    };

    ObjectId m_id;
    ObjectGlobalId m_globalId;
};

QUINCE_CORE_EXPORT QDataStream & operator <<(QDataStream &out, const Object &);
QUINCE_CORE_EXPORT QDataStream & operator >>(QDataStream &in, Object &);

#endif // OBJECT_H
